package com.study.happystudy.po;

import com.study.happystudy.tool.ColorChange;
import lombok.Data;

@Data
public class Paper {
    private String from_lib;
    private String exam_id;
    private Integer subject_id;

    public Paper(String from_lib, String exam_id, Integer subject_id) {
        this.from_lib = from_lib;
        this.exam_id = exam_id;
        this.subject_id = subject_id;
    }

    public static Paper toPaper(ExamPaper examPaper) {
        try {
            return new Paper(examPaper.getName(), "lib_" + examPaper.getExamPaperId(), examPaper.getSubjectId());
        } catch (Exception e) {
            ColorChange.Red(e.getMessage() + "\n");
            return null;
        }
    }
}
